package com.runner.entity;

import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.math.Vector2;
import com.runner.utility.Constants;

public abstract class Entity implements Constants {

	protected GraphicsComponent graphics;
	protected boolean exists;

	public Entity(Vector2 pos, String path, float scale) {
		graphics = new GraphicsComponent(pos, path, scale);
		exists = true;
	}

	public abstract void update(float delta);

	public void render(SpriteBatch sb) {
		graphics.render(sb,this);
	}

	public void render(SpriteBatch sb, float alpha) {
		graphics.render(sb, alpha,this);
	}
	
	public void render(SpriteBatch sb, TextureRegion currentFrame) {
		graphics.render(sb, currentFrame,this);
	}

	public void dispose() {
		graphics.dispose();
	}

	public void delete() {
		exists = false;
	}

	public void revive() {
		exists = true;
	}

	public boolean isExists() {
		return exists;
	}

	public void setExists(boolean exists) {
		this.exists = exists;
	}

	public float renderXPosition(float width){
		return graphics.getPosition().x;
	}
	
	public float renderYPosition(float height){
		return graphics.getPosition().y;
	}

	public void setPosition(Vector2 position) {
		graphics.setPosition(position);
	}
	
	public Vector2 getPosition() {
		return graphics.getPosition();
	}

	public float getDirection() {
		return graphics.getDirection();
	}

	public void setDirection(float direction) {
		graphics.setDirection(direction);
	}

	public void setSprite(Sprite sprite) {
		graphics.setSprite(sprite);
	}
	
	public Sprite getSprite(){
		return graphics.getSprite();
	}
	
	

}
